<?php
include_once 'controller/default.php';
include_once 'model/page/process.php';
    if(isset($_GET)){
        $page = new pages();
        if(isset($_GET["trash"])){
            $delete = $page->Trash($_GET);
            if($delete){
                echo '<script>alert("Thành công.")</script>';
                include 'view/page/page_manager.php';
            }else{
                echo '<script>alert("Thất bại.")</script>';
                include 'view/page/page_manager.php';
            }
        } else if(isset($_GET["id"])){
            $delete = $page->Delete($_GET);
            if($delete){
                echo '<script>alert("Xóa bài viết thành công.")</script>';
                include 'view/page/page_manager.php';
            }else{
                echo '<script>alert("Xóa bài viết thất bại.")</script>';
                include 'view/page/page_manager.php';
            }
        } else if(isset($_GET["restore"])){
            $delete = $page->Restore($_GET);
            if($delete){
                echo '<script>alert("Phục hồi bài viết thành công.")</script>';
                include 'view/page/page_manager.php';
            }else{
                echo '<script>alert("Phục hồi bài viết thất bại.")</script>';
                include 'view/page/page_manager.php';
            }
        }
    }
?>